<script setup>
    import { ref, reactive } from 'vue'

    //字体颜色
    const colorStr=ref('red')

    //响应式对象
    const styleObj=reactive({
      color: 'green',
      background: 'red'
    })
</script>

<template>
<div>
  <p :style="{ color: colorStr}">Style1</p>
  <p :style="styleObj">Style2</p>
</div>
</template>


<style scoped>

</style>